defmodule ChoicePlayground.Questionnaire do
  use ChoicePlayground.Web, :model

  schema "questionnaire" do
    field :seq, :integer
    field :title, :string

    has_many :question, ChoicePlayground.Question
    timestamps()
  end

  @doc """
  Builds a changeset based on the `struct` and `params`.
  """
  def changeset(struct, params \\ %{}) do
    struct
    |> cast(params, [:title, :seq])
    |> validate_required([:title, :seq])
  end
end
